import java.io.*; //Java Library Classes
import java.lang.*;

public class Operators
{ //begins Nums

public static void main(String args[])
	{
		// Examples of binary operators
		int num1= 5;
		int num2= 2;
		int sum;
		int prod;
		int mod;
		sum=  num1 + num2;
		prod= num1 * num2;
		mod= num1 % num2;
		System.out.println(sum); // 7
		System.out.println(prod); // 10
		System.out.println(mod); // 1

		// Example of unary operators
		int i= 16;
		System.out.println(++i + " " + i++ + " " + i); // 17, 17, 18

		int total= 20;
		int a, b, c, d;
		a = total++; // total assigned to a then increment
		b = total; // total assigned to b
		c = ++total; // increment then total assigned to c
		d = total; // total assigned to d
		System.out.println(a + ", " + b + ", " + c + ", " + d);

		// Examples of operator precedence
		int y;
		int z;
		y = 25 - 5 * 4 / 2 - 10 + 4; // 9
		z = (((25 - 5) * 4) / (2 - 10)) + 4;  // -6
		System.out.println(y);
		System.out.println(z);

		// Example of promotion
		int e= 7;
		byte f= 10;
		e = f;
		System.out.println(e); // 10

		// Example of typecasting
		int num3 = 45; // 32 bits of memory
		int num4 = 32; // 32 bits of memory
		byte num5; // 8 bits of memory
		num5 =(byte)(num3 - num4);
		System.out.println(num5); // 13; no error


	} //end main
} //end Nums